package moders

import "gorm.io/gorm"

type Article struct {
	gorm.Model
	Title   string `gorm:"type:varchar(20)" json:"title"`
	Content string `gorm:"type:text" json:"content"`
	Picture string `gorm:"type:varchar(100)" json:"picture"`
}

func (a *Article) AddArticle(db *gorm.DB) error {
	return db.Create(&a).Error
}
func (a *Article) List(db *gorm.DB) (A *[]Article, err error) {
	err = db.Model(&Article{}).Find(&A).Error
	return
}
